<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:pe="http://primefaces.org/ui/extensions"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions">
    <ui:composition template="/layout/masterpage_admin.xhtml">
          <f:metadata>
            
            <f:event type="preRenderView" listener="#{sys_NguoiDungController.onPageLoad_CheckAdmin()}">
                
            </f:event>
        </f:metadata>
         <ui:define name="ui-header">
             <title>#{utilsController.getLanguages("DinhNghiaNgonNgu")}</title>
        </ui:define>
        
        
        <ui:define name="ui-content">
            
            <h:form id="frmNgonNguDet">
                
                <c:set var="vNgonNgu" value="#{sys_NgonNguController.findAllNgonNgu()}" scope="session"/>
                <div class="row">
                    <div class="col-md-3">
                        <div class="btn-group">
                            <a href="/Admin/sys/languagedif/new.html" class="btn btn-default">#{utilsController.getLanguages("TaoMoi")}</a>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <select  id="cboNgonNguID" class="form-control" onchange="cboNgonNguID_change();">
                            <c:forEach items="#{vNgonNgu}" var="item">
                                <option value="#{item.getNgonNguID()}">#{item.getTenNN()}</option>
                            </c:forEach>
                        </select>
                    </div>
                    
                </div>
                <p:outputPanel id="pnNgonNguDet">
                    <c:set var="vNgonNguDet" value="#{sys_NgonNguDetController.findAllNgonNguDet()}" scope="session"/>
                     <div class="panel panel-sea margin-bottom-40">
                        <div class="panel-heading">
                            <h3 class="panel-title"><i class="fa fa-edit"></i>#{utilsController.getLanguages("DinhNghiaNgonNgu")}</h3>
                        </div>
                        <table class="table table-striped">
                            <thead>
                                <tr>
                                    <th>#{utilsController.getLanguages("DinhNghia")}</th>
                                    <th>#{utilsController.getLanguages("NoiDung")}</th>
                                    <th>#</th>
                                </tr>
                            </thead>
                            <tbody>
                                <c:forEach items="#{vNgonNguDet}" var="item">
                                    <tr>

                                        <td>#{item.getDinhNghia()}</td>
                                         <td>#{item.getNoiDung()}</td>
                                          <td>
                                              <button class="btn btn-danger btn-xs" onclick="Delete_NgonNguDet_Click('#{item.getNgonNguID()}','#{item.getDinhNghia()}','#{utilsController.getLanguages('CoChacBanMuonXoaDuLieu')}');" type="button"><i class="fa fa-trash-o"></i> #{utilsController.getLanguages("Delete")}</button>
                                              <button class="btn btn-primary btn-xs" type="button" onclick="Update_NgonNguDet_Click('#{item.getNgonNguID()}','#{item.getDinhNghia()}');"><i class="fa fa-truck-o"></i> #{utilsController.getLanguages("Update")}</button>
                                          </td>
                                    </tr>

                                </c:forEach>


                            </tbody>
                        </table>
                    </div>
                </p:outputPanel>

                
                <p:remoteCommand name="Delete_NgonNguDet" actionListener="#{sys_NgonNguDetController.btnDelete_Click}" update=":frmNgonNguDet"></p:remoteCommand>
                <p:remoteCommand name="Update_NgonNguDet" actionListener="#{sys_NgonNguDetController.btnUpdate_Click}" update=":frmNgonNguDet"></p:remoteCommand>
                <p:remoteCommand name="Change_NgonNguDet" actionListener="#{sys_NgonNguDetController.btnNgonNgu_Change}" update=":frmNgonNguDet:pnNgonNguDet"></p:remoteCommand>
            </h:form>
        </ui:define>
    </ui:composition> 
</html>